import {Injectable} from '@angular/core';
import {RequestService} from './request.service';
import {ApiList} from './common-params';
import {Response} from './response';
import {Observable} from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class ApiService {

  constructor(private request: RequestService) {
  }

  /**
   * 登录
   */
  login(params?: any): Observable<Response> {
    return this.request.post(ApiList.LOGIN, params);
  }

  /**
   * 心跳
   */
  heatBeat(params?: any): Observable<Response> {
    return this.request.get(ApiList.HEAT_BEAT, params);
  }

  /**
   * 修改比赛结果
   */
  submitGame(params?: any): Observable<Response> {
    return this.request.post(ApiList.SUBMIT_GAME, params);
  }

  /**
   * 查询是否有未完成的比赛
   */
  getIfLastGameNotFinish(params?: any): Observable<Response> {
    return this.request.get(ApiList.GET_IF_LAST_GAME_NOT_FINISH, params);
  }
}
